home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 723 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.4 KB  |  37 lines

  1. Newsgroups: comp.std.c
  2. Path: phcoms4.seri.philips.nl!panther!baynes
  3. From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
  4. Subject: It this portable?
  5. Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
  6. Message-ID: <Dpp1tv.4Kq@ukpsshp1.serigate.philips.nl>
  7. Date: Thu, 11 Apr 1996 10:44:17 GMT
  8. Organization: Philips Semiconductors, Southampton, UK
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. In a glossy newsletter from a company (who had better remain nameless) that 
  12. sells tools for testing and validating C code the following bit of code was
  13. given as an example of implementation dependent but portable code across ISO 
  14. C implementations. I know 'portable' is not a term used in the standard, let
  15. us assume it means conforming. Is this program conforming, giving an 
  16. implementation defined result (regardless of the fact the result is probably
  17. not the one intended) or is it going to give undefined behaviour?
  18.  
  19.  
  20. #include <stdio.h>
  21. #include <limits.h>
  22. int main( void )
  23. {
  24.     printf( "%d", UINT_MAX );
  25.     return 0;
  26. }
  27.  
  28. My vote is for undefined, but can anyone construct an argument based on
  29. the represention of integers that makes it implmentation defined?
  30.  
  31. --
  32. Stephen Baynes                              baynes@ukpsshp1.serigate.philips.nl
  33. Philips Semiconductors Ltd
  34. Southampton                                 My views are my own.
  35. United Kingdom
  36.  Are you using ISO8859-1? Do you see ⌐ as copyright, ≈ as division and ╜ as 1/2?
  37.